// pages/test1/index.js
let sys = wx.getSystemInfoSync()
sys.model = sys.model.split('<')[0].split('(')[0]
sys.model = sys.model.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~！@#￥%……&*（）——\-+={}|《》？：“”【】、；‘’，。、 ]/g, '')

var listener = {}

Page({

  /**
   * 页面的初始数据
   */
  data: {
    banner: [
      'http://101.132.97.213:9090/image/1233212212212/1575952652583827.jpg', 
      'http://101.132.97.213:9090/image/1233212212212/1575952653630142.jpg'
    ],
    src: 'https://mp.fot-tech.com/image/1/321.mp4',
    src1: 'https://mp.fot-tech.com/image/1/123.mp4',

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  onCameraGet() { //扫码
    this.data.isFlag = true
    var context = wx.createCameraContext()
    var isFisrt = false

    listener = context.onCameraFrame((frame) => {
      console.log()
      if (!this.data.isFlag) {
        return
      }
      this.setData({
        frameW: frame.width,
        frameH: frame.height

      })
      this.data.isFlag = false
      // listener.stop()
    })
    setTimeout(() => {
      listener.start()
    }, 1000)

  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },
  //加载视频
  onReady: function (res) {
    this.videoContext = wx.createVideoContext('myVideo')
  },
  videoErrorCallback: function (e) {
    console.log('视频错误信息:' + e.detail.errMsg);
  }
})